<?php
	//session_destroy();
	session_start();
	$_SESSION['value']="none";
	class EditApplianceManager{
	
		public function validate($str,$param1,$num){
		
				if((!is_numeric($str))&&is_numeric($param1)&&is_numeric($num)&&($str!=""||$str!=null)){
					return true;
				}else{
					return false;
				}
		}

		public function editStudentForm1($str,$param1,$num){
			$num = $num-1;
			$conn = oci_connect("naiad", "1234", "localhost/XE");
			if((strcmp($str,"snum"))==0){
				$s = oci_parse($conn, "select STUDENTNO, CONTROLNO, TYPE, TERM, DATEINSTALLED, DATECANCELLED, REMARKS FROM APPLIANCE where STUDENTNO like '".$param1."'");
			}				
			
			oci_execute($s);
			$nrows = oci_fetch_all($s, $results);
			if($num>=$nrows||$num<0){
				echo"<script>alert(\"Invalid payment number!\")</script>";
				
			}else{
				$i = $num;
				if($nrows!=0){
					
					$_SESSION['studentno']=$results['STUDENTNO'][$i];
					$_SESSION['controlno']=$results['CONTROLNO'][$i];
					$_SESSION['type']=$results['TYPE'][$i];
					$_SESSION['term']=$results['TERM'][$i];
					$_SESSION['dateinstalled']=$results['DATEINSTALLED'][$i];
					$_SESSION['datecancelled']=$results['DATECANCELLED'][$i];
					$_SESSION['remarks']=$results['REMARKS'][$i];
					
					return 1;	
				}else{
				return 0;
				}
		}
		
		}//end of editStudentInfo function
			
	}//end of EditStudentManager class

?>